<?php
/**
 * alltosun.com  action.php
 * ============================================================================
 * 版权所有 (C) 2009-2013 北京互动阳光科技有限公司，并保留所有权利。
 * 网站地址: http://www.alltosun.com
 * ----------------------------------------------------------------------------
 * 许可声明：这是一个开源程序，未经许可不得将本软件的整体或任何部分用于商业用途及再发布。
 * ============================================================================
 * $Author: 王德康 (wangdk@alltosun.com) $
 * $Date: 2016-6-9 下午12:08:20 $
 * $Id$
 */
class Action
{
    public function __call($action = '', $params = array())
    {
        $data_list = array();
        $table_list = _model('user')->getAll('show tables');
        if ($table_list) {
            foreach ($table_list as $v) {
                $table = $v['Tables_in_baobaotang_old'];
                $result['table_info']  = _model($table)->getRow("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '$table' and TABLE_SCHEMA = 'baobaotang_old'");
                if ($result['table_info']) {
                    $sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, COLUMN_COMMENT, IS_NULLABLE, CHARACTER_MAXIMUM_LENGTH, COLUMN_TYPE, COLLATION_NAME, EXTRA FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '$table' AND table_schema = 'baobaotang_old'";
                    $result['fields_list']  = _model($table)->getAll($sql);
                }
                $data_list[] = $result;
            }
            Response::assign('data_list', $data_list);
        }

        Response::display('admin/table_list.html');
    }
}